from src.Classer.classTest import Student

class man(object):

    def __init__(self, name):
        print("__init__() is called")
        self.name = name

    def greet(self):
        print("hello! I'm " + self.name)

    def __enter__(self):
        print("__enter__() is called")
        # 如果不加return self 会报错
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        print("__exit__() is called")
        # return True
        del self

    def __del__(self):
        print("I'm deleting")


if __name__ == '__main__':
    with man("xxx") as m:
        m.greet()
